﻿namespace EFS.RC.Wallboard.Common.Config.Sections.Phones.Profiles.Charts
{
	public class CallStatistic
	{
		public CallStatistic(System.Configuration.ConfigurationSection section)
		{
			LoadConfig(section);
		}

		#region Properties
		/// Property Total: Get, Set
		public EFS.RC.Wallboard.Common.Config.Sections.Phones.Profiles.Charts.Limits.Limit Total { get; private set; }

		/// Property AverageAnswerSeconds: Get, Set
		public EFS.RC.Wallboard.Common.Config.Sections.Phones.Profiles.Charts.Limits.Limit AverageAnswerSeconds { get; private set; }

		/// Property Abandon: Get, Set
		public EFS.RC.Wallboard.Common.Config.Sections.Phones.Profiles.Charts.Limits.Limit Abandon { get; private set; }
		#endregion

		/// Loads the configuration
		private void LoadConfig(System.Configuration.ConfigurationSection section)
		{
			// check
			EFS.Common.Verify.Reference(section, "section");

			// get section
			System.Collections.Specialized.NameValueCollection nvc =
				(System.Collections.Specialized.NameValueCollection)System.Configuration.ConfigurationManager.GetSection(section.SectionInformation.SectionName);
			EFS.Common.Verify.Reference(nvc, section.SectionInformation.SectionName);

			// read
			Total = EFS.RC.Wallboard.Common.Config.Sections.Phones.Profiles.Charts.Limits.Limit.Get(nvc, "Total");
			AverageAnswerSeconds = EFS.RC.Wallboard.Common.Config.Sections.Phones.Profiles.Charts.Limits.Limit.Get(nvc, "AverageAnswerSeconds");
			Abandon = EFS.RC.Wallboard.Common.Config.Sections.Phones.Profiles.Charts.Limits.Limit.Get(nvc, "Abandon");
		}
	}

}